package com.supermarket.manage.common.dto.ucenter.response;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * @author Faxon
 * @version 1.0
 * @date 2020-04-23 10:37
 **/
@Data
@ApiModel("FatherMenuNode:菜单栏节点")
@NoArgsConstructor
public class MenuNode implements Serializable {

    private static final long serialVersionUID = -5729241053353138337L;

    /**
     * id
     */
    @ApiModelProperty(value = "id")
    private String id;

    /**
     * 路径
     */
    @ApiModelProperty(value = "路径")
    private String path;

    /**
     * 名称
     */
    @ApiModelProperty(value = "名称")
    private String authName;

    /**
     * 子节点
     */
    private List<ChildMenuNode> children;

    public MenuNode(String id, String path, String authName) {
        this.id = id;
        this.path = path;
        this.authName = authName;
        this.children = new ArrayList<>();
    }

    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum ChildMenuNode implements Serializable {
        USER_CENTER("1", "/salesman/users", "个人中心"),
        USER_MANAGE("2", "/salesman/userMessage", "用户列表"),
        ROLE_MANAGE("3", "/salesman/roleMessage", "角色管理"),

        PRODUCT("1", "/salesman/goods", "商品管理"),
        CATEGORY("2", "/salesman/Detail", "分类管理"),

        CREATE_SALE_OUTSTOCK("1", "/salesman/sales", "开销售单"),
        CREATE_SALE_INSTOCK("2", "/salesman/returnGoods", "开退货单"),
        SALE_OUTSTOCK_LIST("3", "/salesman/goodsOutput", "销售出库单"),
        SALE_INSTOCK_LIST("4", "/salesman/returnDocument", "销售退货单"),

        SUPPLIER_MANAGE("1", "/salesman/supplierMessage", "供应商管理"),
        CREATE_PURCHASE_INSTOCK("2", "/salesman/shop", "开进货单"),
        CREATE_PURCHASE_OUTSTOCK("3", "/salesman/outShop", "开退货单"),
        PURCHASE_INSTOCK_LIST("4", "/salesman/inputShop", "采购进货单"),
        PURCHASE_OUTSTOCK_LIST("5", "/salesman/best", "采购退货单"),

        CREAT_STOCKING("1", "/salesman/addinventory", "开盘点单"),
        STOCKING_LIST("2", "/salesman/inventoryDocu", "盘点单列表");
        private static final long serialVersionUID = 5370396459308821313L;
        private String id;
        private String path;
        private String authName;

        private ChildMenuNode() {
        }

        private ChildMenuNode(String id, String path, String authName) {
            this.id = id;
            this.path = path;
            this.authName = authName;
        }

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getPath() {
            return path;
        }

        public void setPath(String path) {
            this.path = path;
        }

        public String getAuthName() {
            return authName;
        }

        public void setAuthName(String authName) {
            this.authName = authName;
        }
    }
}
